import scrcpy
import cv2


#我的屏幕分辨率1920*1080 /1.25  即为1536*864  软件变成了宽为400
client = scrcpy.Client(device="AKHBB21510200494")
#client = scrcpy.Client(device="AKHBB21510200494")
client.max_width=900

image= None
def on_frame(frame):
    # If you set non-blocking (default) in constructor, the frame event receiver
    # may receive None to avoid blocking event.
    if frame is not None:
        # frame is an bgr numpy ndarray (cv2' default format)
        cv2.namedWindow("viz",cv2.WINDOW_AUTOSIZE)
        #cv2.moveWindow("viz", 100, 0)
        frame=cv2.resize(frame,dsize=None,fx=1.1,fy=1.1,interpolation=cv2.INTER_LINEAR)
        cv2.imshow("viz", frame)
        image = frame
    cv2.waitKey(10)

client.add_listener(scrcpy.EVENT_FRAME, on_frame)
client.start()
